/*
 * Copyright 2008 Jeff Dwyer
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package edu.rpi.bt.server.service.gwt;

import java.util.List;

import org.apache.log4j.Logger;

import com.apress.progwt.client.domain.User;
import com.apress.progwt.client.domain.commands.SiteCommand;
import com.apress.progwt.client.domain.dto.ForumBootstrap;
import com.apress.progwt.client.exception.SiteException;
import com.apress.progwt.client.service.remote.GWTDestinationService;
import com.apress.progwt.server.gwt.GWTController;

import edu.rpi.bt.client.domain.Comment;
import edu.rpi.bt.client.domain.Destination;
import edu.rpi.bt.server.service.DestinationService;

/**
 * 
 * @author Ashoo
 * 
 *         
 */
public class GWTDestinationServiceImpl extends GWTController
        implements GWTDestinationService {

    private static final Logger log = Logger
            .getLogger(GWTDestinationServiceImpl.class);

    private DestinationService destinationService;

    public List<String> getDestinationsMatching(String match)
            throws SiteException {
        return destinationService.getDestinationStringsMatching(match);
    }

    public void setDestinationService(DestinationService destinationService) {
        this.destinationService = destinationService;
    }

    public SiteCommand executeAndSaveCommand(SiteCommand comm)
            throws SiteException {
        return destinationService.executeAndSaveCommand(comm);
    }

    

    public List<Destination> getAllDestinations() throws SiteException {
        return destinationService.getAllDestinations();
    }
    
    
    
    public List<Destination> getAllTrips() throws SiteException {
        return destinationService.getAllTrips();
    }
    
    public List<Destination> getAllLocations(long tripId) throws SiteException {
        return destinationService.getAllLocations(tripId);
    }
    
 //   public List<Destination> getAllLocations(double lat, double lon) {
   //     return destinationService.getAllLocations(lat, lon);
    //}
    
    public List<Destination> getAllLocations(double minLat, double minLon, double maxLat, double maxLon){
    //      System.out.println("In GWT get ALlLocations");
        return destinationService.getAllLocations(minLat, minLon, maxLat, maxLon);
    }
    
    public List<Destination> getAllLocations(double lat, double lon){
      //  System.out.println("In GWT get ALlLocations");
      return destinationService.getAllLocations(lat, lon);
  }
  
    public List<Comment> getAllCommentsForLocation(long destId){
   //     System.out.println("In GWT get ALlComments");
      return destinationService.getAllCommentsForLocation(destId);
  }
    
    
    public List<Destination> getDestinationsForUser(User user) throws SiteException {
        return destinationService.getAllDestinations();
    }
    
    
    public Destination getDestinationDetails(String destinationName) {
        return destinationService.getDestinationDetails(destinationName);
    }
    
    public Destination getDestination(long  destId) {
        return destinationService.getDestination(destId);
    }

    public ForumBootstrap forumBootstrapDummy() {
        return null;
    }

    public List<Destination> getNDestinations(int n) throws SiteException {
        return destinationService.getNDestinations(n);
    }
    
    public List<Comment> getAllComments() throws SiteException {
        return destinationService.getAllComments();
    }

    public List<String> getImages(String search,int num) throws SiteException {
        return destinationService.getImages(search, num);
    }
    
    public List<Comment> getNComments(int n) throws SiteException {
        return destinationService.getNComments(n);
    }
}
